// pages/Clearing/Clearing.js
import {
  Config
} from "../../../utils/config.js";
import api from "../../../utils/api.js"
import * as com from "../../../utils/common.js"
const Base = new com.Base();
var app = getApp();

Page({
  data: {
    // 商品图片基准路径
    baseImgUrl: Config.host,

    // 商品
    goods: [
      {
        name: '2条装 男士梭织绅士内裤',
        num: 1,
        size: 'XL;藏青方格+黑红千鸟格',
        price: '65.00'
      }
    ],

    // 地址信息
    site_info: null,
  },

  onLoad: function(options) {
    this.set_site()
  },

  // 新增地址
  addNewSite: function() {
    var that = this
    var site_info = this.data.site_info

    wx.chooseAddress({
      success: function(res) {
        console.log(res)
        var site_info = res
        var detail_site = site_info.provinceName + site_info.cityName + site_info.countyName + site_info.detailInfo;
        console.log('详细地址:' + detail_site)
        site_info.detail_site = detail_site

        app.globalData.site_info = site_info
        that.setData({
          site_info: site_info
        })
      }
    })
  },

  // 设置地址
  set_site() {
    this.setData({
      site_info: app.globalData.site_info
    })
  },




})